﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  System.Data.SqlClient;

namespace TrainingWorkshop.DAL
{
    public class SqlFactory:IFactory
    {
        /// <summary>
        /// Sql Connection
        /// </summary>
        private SqlConnection _conn;

        /// <summary>
        /// getter and setter of Conn
        /// </summary>
        public SqlConnection Conn
        {
            get { return _conn; }
            set { _conn = value; }
        }
        /// <summary>
        /// Constructor
        /// no parameter
        /// </summary>
        public SqlFactory() {
            this.Conn = new SqlConnection(SQLHelper.ConnectionStringProjectb);
        }
        public IRepository CreateTeacherRepository()
        {
            return new TeacherRepository_Sql(this.Conn);
        }
        public IRepository CreateLevelRepository()
        {
            return new LevelRepository_Sql(this.Conn);
        }
        public IRepository CreateCourseListRepository()
        {
            return new CourseListRepository_Sql(this.Conn);
        }

    }
}
